<style>
    .row-sm {
        margin: 10px 10px 0px 10px;
    }
</style>
<div class="row row-sm">
    <div class="col-sm-12">
        <!-- this is title! -->
    </div>
    <div class="row row-sm">
        <div class="col-sm-9">
            <button type="button" class="btn btn-primary btn-xs" ng-show="info.isView" ng-disabled="info.isDisabled" ng-click="addFlow()"><i class="fa fa-plus"></i> 新增</button>
            <button type="button" class="btn btn-info btn-xs" ng-show="info.isView" ng-disabled="info.isDisabled" ng-click="addFlow()"><i class="fa fa-edit"></i> 修改</button>
            <button type="button" class="btn btn-danger btn-xs" ng-show="info.isView" ng-disabled="info.isDisabled"><i class="fa fa-trash"></i> 删除</button>
        </div>
        <div class="col-sm-3 pull-right">
            <m-single-switch show-label="列表"
                                behind-label="流程图"
                                default-status=false
                                switch-change-fun="switchViewChange(status)">
            </m-single-switch>
            <m-single-switch show-label="显示master"
                                behind-label="隐藏master"
                                default-status=false
                                switch-change-fun="switchMasterChange(status)">
            </m-single-switch>
        </div>
    </div>
    <div class="row row-sm">
        <div class="col-sm-6" ng-show="info.isView">
            <m-timeline start-name="开始"
                        val-list="info.data"
                        click-node-fun="clickNode(data)"
                        click-node-title-fun="clickShowNode(data)">
            </m-timeline>
        </div>
        <div class="col-sm-6" ng-show="info.isView && info.isMaster">
            <m-timeline start-name="开始Master"
                        val-list="info.data"
                        click-node-fun="clickNode(data)"
                        click-node-title-fun="clickShowNode(data)">
            </m-timeline>
        </div>
        <div class="col-sm-12" ng-show="!info.isView">
            <table class="table table-bordered table-hover table-condensed">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>名称</th>
                        <th>路径</th>
                        <th>描述</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="d in info.data" data-id="{{$index}}">
                        <td>{{$index}}</td>
                        <td data-type="input">
                            <span data-status="true" ng-if="!d.isNewTr">{{d.user}}</span>
                            <input type="text" class="form-control hide" ng-model="d.user" data-status="false" ng-if="!d.isNewTr">
                            <input type="text" class="form-control" ng-model="d.user" data-status="true" ng-if="d.isNewTr">
                        </td>
                        <td data-type="select">
                            <span data-status="true" ng-if="!d.isNewTr">{{d.pathId}}</span>
                            <div class="hide" data-status="false" ng-if="!d.isNewTr">
                                <ui-select ng-model="info.selectedPath" theme="bootstrap">
                                    <ui-select-match placeholder="请选择...">{{$select.selected.name}}</ui-select-match>
                                    <ui-select-choices repeat="item in info.pathList | filter: $select.search|limitTo:15">
                                        <div ng-bind-html="item.name | highlight: $select.search"></div>
                                        <small ng-bind-html="item.path | highlight: $select.search"></small>
                                    </ui-select-choices>
                                </ui-select>
                            </div>
                            <div data-status="true" ng-if="d.isNewTr">
                                <ui-select ng-model="info.selectedPath" theme="bootstrap">
                                    <ui-select-match placeholder="请选择...">{{$select.selected.name}}</ui-select-match>
                                    <ui-select-choices repeat="item in info.pathList | filter: $select.search|limitTo:15">
                                        <div ng-bind-html="item.name | highlight: $select.search"></div>
                                        <small ng-bind-html="item.path | highlight: $select.search"></small>
                                    </ui-select-choices>
                                </ui-select>
                            </div>
                        </td>
                        <td data-type="textarea">
                            <span data-status="true" ng-if="!d.isNewTr">{{d.desc}}</span>
                            <textarea class="form-control hide" data-status="false" ng-model="d.desc" ng-if="!d.isNewTr"></textarea>
                            <textarea class="form-control" data-status="true" ng-model="d.desc" ng-if="d.isNewTr"></textarea>
                        </td>
                        <td calss="actions">
                            <button type="button" class="btn btn-info btn-xs" data-index="{{$index}}" data-status="true" ng-click="clickEditBtn(d, $index)" ng-if="!d.isNewTr">编辑</button>
                            <button mwl-confirm
                                    class="btn btn-danger btn-xs"
                                    data-index="{{$index}}"
                                    data-status="true"
                                    ng-if="!d.isNewTr"
                                    tabindex="0" 
                                    title="删除"
                                    message="确定要删除此数据吗？"
                                    confirm-text="确定 <i class='fa fa-check'></i>"
                                    cancel-text="取消 <i class='fa fa-remove'></i>"
                                    placement="bottom"
                                    on-confirm="clickDeleteBtn(d, $index)"
                                    on-cancel=""
                                    confirm-button-type="danger"
                                    cancel-button-type="default">
                                    删除
                            </button>
                            <button type="button" class="btn btn-success btn-xs hide" data-index="{{$index}}" data-status="false" ng-click="clickSaveBtn(d, $index)" ng-if="!d.isNewTr">保存</button>
                            <button type="button" class="btn btn-default btn-xs hide" data-index="{{$index}}" data-status="false" ng-click="clickCancelBtn(d, $index)" ng-if="!d.isNewTr">取消</button>
                            <button type="button" class="btn btn-success btn-xs" data-index="{{$index}}" data-status="true" ng-click="clickSaveBtn(d, $index)" ng-if="d.isNewTr">保存</button>
                            <button type="button" class="btn btn-default btn-xs" data-index="{{$index}}" data-status="true" ng-click="clickCancelBtn(d, $index)" ng-if="d.isNewTr">取消</button>
                        </td>
                    </tr>
                </tbody>
            </table>

            <button class="btn btn-default m-b-lg" ng-click="addTr()">添加行</button>
        </div>
    </div>
</div>